package code.tools.method 
{
	import code.main.AppData;
	import code.structure.module.configs.data.ItemConfigData;
	import code.untils.ItemTypeConst;
	
	/**
	 * 获取资源路径
	 * @author CYang
	 */
	public class ResourcePath 
	{
		
		public function ResourcePath() 
		{
			
		}
		/**
		 * 获取资源路径
		 * @param	id 物品ID
		 * @param	type 物品类型
		 * @return
		 */
		public static function getResPath(item:ItemConfigData, type:int):String
		{
			var id:int = item.id;
			switch(type) {
				case ItemTypeConst.MARKET_CONSUMABLE:
					item.fileType = "png";
					if(item.subType == ItemTypeConst.SUB_FEED_REQUEST)//由于feedRequest的物品在仓库里显示时被归结到消耗品类中，所以这样判断
						return productURL("new_image/" + ItemTypeConst.MARKET_FEED_REQUEST + "/", id, "png");
					return productURL("new_image/" + type + "/", id, "png");
					break;
				case ItemTypeConst.MARKET_DECORATION:
				case ItemTypeConst.MARKET_KITCHEN_WARE:
				case ItemTypeConst.MARKET_TABLE_CHAIR:
				case ItemTypeConst.MARKET_SUPPLIES:
				case ItemTypeConst.MARKET_AVATAR:
				case ItemTypeConst.MARKET_BUILDING:
				case ItemTypeConst.MARKET_OPERATE:
				case ItemTypeConst.MARKET_RUBBISH:
				case ItemTypeConst.MARKET_ENERGY_WALL:
				case ItemTypeConst.MARKET_PET:
				case ItemTypeConst.MARKET_SHOP:
					return productURL("new_build/" + type + "/", id, "swf");
					break;
				case ItemTypeConst.MARKET_DESSERT:
					return productURL("new_image/" + type + "/", id, "swf");
					break;
				default:
					item.fileType = "png";
					return productURL("new_image/" + type + "/", id, "png");
					break;
			}
			return "";
		}
		
		public static function getRecipeAniResPath(id:int):String
		{
			return productURL("recipe/",id,'swf');
		}
		
		/**
		 *返回商店活动热卖资源路径 
		 * @param id
		 * @return 
		 * 
		 */		
		public static function getMarketActivitiesHotPath(id:int):String
		{
			return AppData.resourceUrl + "outresource/market/activitiesHot/"+AppData.language + "/" + id + ".swf";
		}
		
		/**
		 *Npc全身形象 
		 * @param taskId
		 * @return 
		 * 
		 */		
		public static function getTaskNpcAvatar2d(taskId:String):String
		{
			return AppData.resourceUrl +"outresource/avatar2d/NPC" + taskId + ".png";
		}
		
		/**
		 *Npc半身形象
		 * @param taskId
		 * @return 
		 * 
		 */		
		public static function getNpcAvatar2dBust(taskId:String):String
		{
			return AppData.resourceUrl +"outresource/npcAvatar_task/NPC" + taskId + ".png";
		}
		/**
		 *获取广告宣传图的地址
		 * @param key ad_img
		 * @return 
		 * 
		 */		
		public static function getPublicityImg(key:String):String
		{
			return AppData.resourceUrl +"outresource/publicity/" + AppData.language + "/" + key;
		}
		/**
		 * 生成地址
		 * @param	url
		 * @param	id
		 * @return
		 */
		private static function productURL(url:String, id:int, type:String):String {
			return AppData.resourceUrl +"outresource/" + url + id + "." + type;
		}
		/**
		 * 获取任务图标地址
		 * @param	icon
		 * @return
		 */
		public static function getTaskIcon(icon:String):String {
			return AppData.resourceUrl +"outresource/task/taskicon/" + icon; //+ ".png";
			//return AppData.resourceUrl +"outresource/task/taskicon/" + "test1" + ".png";
		}
		/**
		 * 获取子任务图标地址
		 * @param	icon
		 * @return
		 */
		public static function getSubTaskIcon(icon:String):String {
			return AppData.resourceUrl +"outresource/task/subtaskicon/" + icon; //+ ".png";
			//return AppData.resourceUrl +"outresource/task/subtaskicon/" + "test2" + ".png";
		}
		/**
		 * 获取衣服路径
		 * @param	id
		 * @return
		 */
		public static function getClothesPath(id:int):String {
			return AppData.resourceUrl +"outresource/new_build/"+ItemTypeConst.MARKET_AVATAR+"/" + id + ".swf";
		}
		/**
		 * 获取好友facebook头像地址
		 * @param	id
		 * @return
		 */
		public static function getFriendHeadPicture(id:String):String {
			return "https://graph.facebook.com/" + id + "/picture";
		}
		
		/**
		 * 获取收集兑换活动地址 
		 * @param id
		 * @return 
		 * 
		 */		
		public static function getExchangePath(id:int):String
		{
			return AppData.resourceUrl + "outresource/activity/EXCHANGE/" + AppData.language + "/" +id+'.png';
		}
		/**
		 *获取对话地址 
		 * @param id
		 * @return 
		 * 
		 */		
		public static function getTalkPath(id:int):String
		{
			return AppData.resourceUrl + "outresource/activity/talk/" +id+'.swf';
		}
		
		/**
		 * 获取拉霸活动ICON地址 
		 */
		public static function getSlotPath(id:int, type:String = "png"):String{
			if(type == "png") return AppData.resourceUrl + "outresource/activity/slots/" + AppData.language+ "/" + id + '.png';
			return AppData.resourceUrl + "outresource/activity/slots/" + id + '.swf';
		}
		/**
		 * 获取个人目标活动资源地址 
		 * @param id
		 * @return 
		 * 
		 */		
		public static function getPerGoalPath(id:int):String
		{
			return AppData.resourceUrl + "outresource/activity/perGoal/perGoalRes_" +id+'.swf';
		}
		/**
		 * 获取招待品尝活动资源地址 
		 * @param id
		 * @return 
		 * 
		 */		
		public static function getTastePath(id:int):String
		{
			return AppData.resourceUrl + "outresource/activity/taste/taste_" + id +'.swf';
		}

		/**
		 * 获取排行榜模板
		 */	
		public static function getRankTemplete(id:int):String
		{
			return AppData.resourceUrl + "outresource/activity/rank/" + id +'.swf';
		}
		
		/**
		 * 获取美食旅行者活动资源地址 
		 * @param id
		 * @return 
		 * 
		 */		
		public static function getCateTravellerPath(id:int):String
		{
			return AppData.resourceUrl + "outresource/activity/traveller/cateTraveller_" + id +'.swf';
		}
		/**
		 * 获取美食旅行团活动资源地址 
		 * @param id
		 * @return 
		 * 
		 */		
		public static function getCateGroupPath(id:int):String
		{
			return AppData.resourceUrl + "outresource/activity/cateGroup/cateGroupTemple_" + id +'.swf';
		}
		/**
		 *获取UI上的一些素材地址 
		 * @param nameStr
		 * @return 
		 * 
		 */		
		public static function getUiIcon(nameStr:String):String
		{
			return AppData.resourceUrl +"outresource/uiIcon/" + nameStr + ".png";
		}
		/**
		 * 获取等级礼包的UI图片素材
		 * @param id
		 */		
		public static function getLevelGiftPackUIIcon(id:int):String
		{
			return AppData.resourceUrl +"outresource/levelGiftIcon/" + id + ".png";
		}
		/**
		 * 获取好友邀请界面，左侧显示的图
		 */		
		public static function getFreeGiftIcon(id:int):String
		{
			return AppData.resourceUrl +"outresource/requestImg/" + id + ".png";
		}
		
		/**
		 * 获取活跃度图片
		 */		
		public static function getLivenessIcon(id:int):String
		{
			return AppData.resourceUrl +"outresource/livenessIcon/" + id + ".png";
		}
		/**
		 * 获取party活动回合图片
		 */		
		public static function getPartyRoundPic(id:int, lv:int, suff:String = ".jpg", prefix:String = ""):String
		{
			return AppData.resourceUrl + "outresource/activity/party/round/"+ prefix + id + "_"+ lv + suff;
		}
		/**
		 * 获取party活动回合动画
		 */	
		public static function getPartyRoundAnimation(id:int, lv:int):String
		{
			return AppData.resourceUrl + "outresource/activity/party/animation/" + id + "_"+ lv +'.swf';
		}
		/**
		 * 获取party活动UI
		 */	
		public static function getPartyUi(id:int):String{
			return AppData.resourceUrl + "outresource/activity/party/ui/party_" + id+ '.swf';
		}
		/**
		 * 获取招待的装饰物升级相关素材
		 */		
		public static function getTasteWithDecorationUpPic(id:int, lv:int, suff:String = ".jpg", prefix:String = ""):String
		{
			return AppData.resourceUrl + "outresource/activity/taste/decorationUp/"+ prefix + id + "_"+ lv + suff;
		}
	}
}